-
Notifications
You must be signed in to change notification settings - Fork 537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove initialize_docker: Integrate data initialization to make up #22663
Conversation
0810482
to
5737991
Compare
44d0a4f
to
6b9dbdc
Compare
I tried following the testing steps and seemed to be a state where the script thought I had a database ("Database already exists") and needed to run all the migrations, which seems wrong. log
|
@eviljeff This looks like expected behavior. If you follow the tests and the code the migrations always run. I'd be curious what happens if you run make up again. It should simply say all migrations have been applied. Look at the test cases for more sophisticated scenarios. |
I'm trying to test the scenario of a clean install - that all the migrations had to run indicates the database was empty, but initialize_data seemingly didn't do that creation, because the logging indicates the database already existed at that point. |
Can you show me exactly what you ran to do a fresh install? For that you'd have to drop the mysql volume and run make up. or run with It looks like the database existsed, but was not migrated in this case. I'm not totally sure how that happened so I would need more context on exactly what you ran. |
I'm very glad you caught that. That was a bug and in squashing it I realized that this is still a lot more complicated than it needs to be. I'm going to switch back to draft and will re-request review once I've updated the code/tests. |
66c6a6c
to
cbb9f0d
Compare
99e4844
to
a4b5460
Compare
That didn't work for me, reindex did not occur, and I was left with a broken frontend. I can see these initialization steps (but no reindex) in the output:
|
@diox this commit fixes that issue. Was introduced by a different PR that landed in between this one opening and now. |
Rename "initialize_data" to "initialize" Remove DOCKER_SERVICES as dangerous option given hard dependency on mysqld and elasticsearch. Better timing for mysql healthcheck
Fixes: mozilla/addons#15020
Description
Integrate data initialization to make up by integrating the 3 types of data initiailization commands to management commands, making them idempotent, and hooking them into make up.
With this, we no longer need
initialize_docker
as make up will do everything it does if the project is pristine.Context
We haven't really needed the initiailzation command for a while, but now that everyone is fairly used to rely on make up for "doing everything" we should make it actually do everything.
This approach integrates data initialization as another part of the make up pipeline. What is mostly different here is that now make up will ensure:
This has a pleasant side effect that CI now verifies database migrations more explicitly. We could consider migrating our testDB to use the regular DB in CI, but that is outside of this PRs scope.
Testing
You should run
make up
in the following scenarios.make down && make docker_mysqld_volume_remove
).make up
to start from a "clean" data perspective. Expect: create DB, seed DB, index.make up
again with running container and seeded db Expect: it does nothingmake down && make up
Expect: It should skip seeding and only reindex the DB.make shell
and run./manage.py flush --noinput
. Then runmake down && make up
Expect: it should reseed DB and reindex again.Expect the flags to work as expected:
INIT_CLEAN
: will wipe DB and index and reseed and reindex regardless of the existing DB stateINIT_LOAD
: will load the given snapshot name and reindex.DATA_BACKUP_SKIP
: This will skip the initialize command entirely. No migration/seed/load/reindex, nothing.The command itself is tested for various scenarios specified above. But you can manually inspect the commands run as the tests do not test the results of the commands but the execution order.
Checklist
#ISSUENUM
at the top of your PR to an existing open issue in the mozilla/addons repository.